<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>抱团</title>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui,viewport-fit=cover"/>
    <meta http-equiv="Access-Control-Allow-Origin" content="*"/>
    <meta name="keywords" content="抱团">
    <meta name="description" content="抱团">
    <script type="text/javascript" src="js/base.js" charset="UTF-8"></script>
    <link rel="stylesheet" type="text/css" href="css/theme-chalk/index.css">
    <link rel="stylesheet" type="text/css" href="css/swiper-bundle.min.css">
    <link rel="stylesheet" type="text/css" href="css/base.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script type='text/javascript' src="js/jquery.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="js/html2canvas.min.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/layer/layer.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/vue.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/axios.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="js/elementui.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="js/swiper-bundle.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="js/qrcode.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="js/clipboard.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/helper.js" charset="UTF-8"></script>
</head>
<style>
    html, body, .wrapperbox {
        height: 100%;
        overflow: hidden;
        position: relative;
    }

    .scrollbox {
        height: 100%;
        overflow: scroll;
    }
</style>
<body>
<div class="wrapperbox indexpage hasmenu" id="app" v-show="loaded==true">
    <div class="scrollbox">
        <div class="top">
            <div class="swiper-container swiper-no-swiping">
                <div class="swiper-wrapper">
                    <div class="swiper-slide" v-for="item in bannerData"
                         :style="{'background-color':(item.theme_color!=''?item.theme_color:'#6C7AA4')}"></div>
                </div>
            </div>
        </div>
        <div class="header">
            <div class="position">
                <span>成武县</span>
<!--                <div class="icon"><i class="el-icon-arrow-right"></i></div>-->
            </div>
            <a href="search.html" class="searchbox">
                <div class="icon">
                    <i class="icon el-icon-search"></i>
                </div>
                <span class="input">为您找到最优惠的商品</span>
                <div :class="['icon','clear',{'show': serachtxt!=''}]" @click="clearSearch">
                    <i class="el-icon-circle-close"></i>
                </div>
            </a>
            <div class="btn" @click="openpop"><img src="images/codeBtn.png" alt=""></div>
        </div>
        <div class="swiperbox">
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide" v-for="item in bannerData">
                        <a :href="item.jump_url" v-if="item.jump_url!=''">
                            <img :src="item.image_url" alt="">
                        </a>
                        <img :src="item.image_url" alt="" v-else>
                    </div>
                </div>
                <div class="swiper-pagination"></div>
            </div>
        </div>
        <div class="menu">
            <div class="scroll">
                <div class="itembox">
                    <div class="item" v-for="item in menuData">
                        <div class="it" v-if="cateId==item.id" :cate_id="item.id">
                            <div class="img">
                                <img :src="item.selected_image_url" alt="">
                            </div>
                            <p>{{item.name}}</p>
                        </div>
                        <div class="it" v-else :cate_id="item.id" @click="changeCate(item.id)">
                            <div class="img">
                                <img :src="item.image_url" alt="">
                            </div>
                            <p>{{item.name}}</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="cate0" v-if="cateId==0">
            <div class="tehuibox" v-if="tehuiData!=''">
                <div class="product">
                    <h3 class="title">每日特惠</h3>
                    <a :href="'./product.html?id='+tehuiData.id">
                        <div class="img"><img :src="tehuiData.cover_image_url" alt=""></div>
                        <div class="text">
                            <h4>{{tehuiData.title}}</h4>
                            <p>{{tehuiData.intro}}</p>
                        </div>
                        <div class="label">
                            <div class="fl">
                                <h5><em>￥</em>{{tehuiData.sale_price}}</h5>
                                <span><em>门市价：¥{{tehuiData.original_price}}</em><span>已售：{{tehuiData.sales_units}}</span></span>
                            </div>
                            <div class="ab" @click.prevent.stop="openhbpop('tehuiData')"><img src="images/index-ab.png"
                                                                                              alt=""><span>分享海报</span>
                            </div>
                        </div>
                    </a>
                </div>
            </div>
            <div class="hotbox" v-if="hotData!=''">
                <h3 class="title"><img src="images/index-title-l.png" alt=""><span>热门商品</span><img
                        src="images/index-title-r.png" alt=""></h3>
                <div class="probox">
                    <a :href="'./product.html?id='+item.id" class="product" v-for="(item,i) in hotData">
                        <p class="tit">本商品由{{item.merchant_name}}提供</p>
                        <div class="img">
                            <img :src="item.cover_image_url" alt="">
                            <div class="status wait" v-if="item.ongoing_status=='coming_soon'">
                                <span><i v-if="showTime[i].dd!=0">{{showTime[i].dd}}天</i>{{showTime[i].hh}}小时{{showTime[i].mm}}分钟{{showTime[i].ss}}秒</span>
                                <span>待开抢</span>
                            </div>
                            <div class="status going" v-if="item.ongoing_status=='on_sale'"><span>抢购中</span></div>
                            <div class="status goend" v-if="item.ongoing_status=='offline_soon'">
                                <span><i v-if="showTime[i].dd!=0">{{showTime[i].dd}}天</i>{{showTime[i].hh}}小时{{showTime[i].mm}}分钟{{showTime[i].ss}}秒</span>
                                <span>即将下架</span>
                            </div>
                            <div class="status" v-if="item.ongoing_status=='expired'"><span>已下架</span></div>
                        </div>
                        <div class="text">
                            <h4>{{item.title}}</h4>
                            <p>{{item.intro}}</p>
                        </div>
                        <div class="label">
                            <div class="fl">
                                <h5><em>￥</em>{{item.sale_price}}</h5>
                                <span><em>门市价：¥{{item.original_price}}</em><span>已售：{{item.sales_units}}</span></span>
                            </div>
                            <div class="ab" @click.prevent.stop="openhbpop('hotData',i)"
                                 v-if="item.min_talent_profit!=item.max_talent_profit"><img src="images/search-ab.png"
                                                                                            alt=""><span>返</span><span
                                    class="price"><em>￥</em>{{item.min_talent_profit}}-{{item.max_talent_profit}}</span>
                            </div>
                            <div class="ab" @click.prevent.stop="openhbpop('hotData',i)" v-else><img
                                    src="images/search-ab.png" alt=""><span>返</span><span class="price"><em>￥</em>{{item.min_talent_profit}}</span>
                            </div>
                        </div>
                    </a>
                </div>
            </div>
        </div>
        <div class="cate hotbox" v-else>
            <div class="empty" v-if="proData.length==0">
                <div class="img"><img src="images/order-empty.png" alt=""></div>
                <p>该分类下暂时还有商品</p>
            </div>
            <div class="probox" v-else>
                <a :href="'./product.html?id='+item.id" class="product" v-for="(item,i) in proData">
                    <p class="tit">本商品由{{item.merchant_name}}提供</p>
                    <div class="img">
                        <img :src="item.cover_image_url" alt="">
                        <div class="status wait" v-if="item.ongoing_status=='coming_soon'">
                            <span><i v-if="showTime[i].dd!=0">{{showTime[i].dd}}天</i>{{showTime[i].hh}}小时{{showTime[i].mm}}分钟{{showTime[i].ss}}秒</span>
                            <span>待开抢</span>
                        </div>
                        <div class="status going" v-if="item.ongoing_status=='on_sale'"><span>抢购中</span></div>
                        <div class="status goend" v-if="item.ongoing_status=='offline_soon'">
                            <span><i v-if="showTime[i].dd!=0">{{showTime[i].dd}}天</i>{{showTime[i].hh}}小时{{showTime[i].mm}}分钟{{showTime[i].ss}}秒</span>
                            <span>即将下架</span>
                        </div>
                        <div class="status" v-if="item.ongoing_status=='expired'"><span>已下架</span></div>
                    </div>
                    <div class="text">
                        <h4>{{item.title}}</h4>
                        <p>{{item.intro}}</p>
                    </div>
                    <div class="label">
                        <div class="fl">
                            <h5><em>￥</em>{{item.sale_price}}</h5>
                            <span><em>门市价：¥{{item.original_price}}</em><span>已售：{{item.sales_units}}</span></span>
                        </div>
                        <div class="ab" @click.prevent.stop="openhbpop('proData',i)"
                             v-if="item.min_talent_profit!=item.max_talent_profit"><img src="images/search-ab.png"
                                                                                        alt=""><span>返</span><span
                                class="price"><em>￥</em>{{item.min_talent_profit}}-{{item.max_talent_profit}}</span>
                        </div>
                        <div class="ab" @click.prevent.stop="openhbpop('proData',i)" v-else><img
                                src="images/search-ab.png" alt=""><span>返</span><span class="price"><em>￥</em>{{item.min_talent_profit}}</span>
                        </div>
                    </div>
                </a>
            </div>
        </div>
        <p v-if="loading==false" class="loading">加载中...</p>
        <p v-if="has_more==false && proData.length>10" class="loading">没有更多了</p>
    </div>
    <div class="pop indexcode">
        <div class="shadow"></div>
        <div class="wrap">
            <div @click="closepop" class="close"><img src="images/index-close.png" alt=""></div>
            <div class="popcon">
                <div class="code"><img src="images/index-code.png" alt=""></div>
                <div class="point"><img src="images/index-point.png" alt=""></div>
                <div class="tit1"><img src="images/index-tit1.png" alt=""></div>
                <div class="tit2"><img src="images/index-tit2.png" alt=""></div>
            </div>
        </div>
    </div>
    <div class="pop hbpop">
        <div class="shadow"></div>
        <div class="wrap">
            <div class="wrapcon">
                <div @click="closehbpop" class="close"><img src="images/index-close.png" alt=""></div>
                <div class="popcon">
                    <div class="tit">分享获取 <span>{{hbprofit}}</span> 元收益</div>
                    <div class="imgbox">
                        <div class="img" v-for="(item,i) in hbimgs" v-if="i==0" :data-index="i" @click="openbigimg(i)"
                             :style="{'background-image': 'url('+item+')'}"><span>海报</span></div>
                        <div class="img" v-for="(item,i) in hbimgs" v-if="i>0" :data-index="i" @click="openbigimg(i)"
                             :style="{'background-image': 'url('+item+')'}"></div>
                    </div>
                    <p class="imgtip"><span>点击图片保存</span><img src="images/sj.png" alt=""></p>
                    <div class="text">
                        <p>{{hbtxt}}</p>
                        <div class="btn copy-btn" @click="copy">一键复制文字</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="pop bigimg">
        <div class="shadow"></div>
        <div class="wrap">
            <div class="wrapcon">
                <div @click="closebigimg" class="close"><img src="images/index-close.png" alt=""></div>
                <div class="popcon type1">
                    <div class="hbcon">
                        <img :src="hb" alt="">
                    </div>
                </div>
                <div class="popcon type2">
                    <div class="swiper-container">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide" v-for="(item,i) in hbimgs" v-if="i>0">
                                <img :src="item" alt="">
                            </div>
                        </div>
                    </div>
                </div>
                <p class="tip">长按保存图片</p>
            </div>
        </div>
    </div>
    <div class="hbcanvas">
        <img class="hbbg" :src="hbimg" alt="" crossorigin="anonymous">
        <div class="code">
            <div id="qrcodeOne" class="qrcode"></div>
        </div>
    </div>
    <div class="indexbotmenu">
        <a href="./index.html" class="item">
            <div class="img"><img src="images/index-botmenu-ico1-select.png" alt=""></div>
            <p>首页</p>
        </a>
        <a href="./order.html" class="item">
            <div class="img"><img src="images/index-botmenu-ico2.png" alt=""></div>
            <p>订单</p>
        </a>
        <a href="./my.html" class="item">
            <div class="img"><img src="images/index-botmenu-ico3.png" alt=""></div>
            <p>我的</p>
        </a>
    </div>
</div>

</body>
<script>
  var bigimgSwiper = '';
  new Vue({
    el: '#app',
    data() {
      return {
        loaded: false,
        bannerData: '',
        menuData: '',
        tehuiData: '',
        hotData: '',
        showTime: [],
        getTime: null,
        propage: 1,
        limit: 10,
        proData: '',
        serachtxt: '',
        cateId: 0,
        allowclick: true,
        loading: true,
        has_more: true,
        hb: '',
        hbprofit: '',
        hbtxt: '',
        hbimg: '',
        hbimgs: [],
        product_id: '',
        talent_id: '',
        user_info: {},
      }
    },
    mounted() {
      
      var that = this;
      var user_info = JSON.parse(getCookie("user_info"));
      console.log(user_info)
      if (!user_info) {
        that.isLogin = false;
      } else {
        that.isLogin = true;
        that.user_info = user_info;
      }
      that.getinitdata();
    },
    methods: {
      getTimeList() {
        var that = this;
        that.getTime = setInterval(function () {
          var arr = [];
          var num = 0;
          for (var i in that.showTime) {
            arr.push(that.showTime[i]);
            if (that.showTime[i].time == 0) {
              num++;
            }
          }
          for (var i in arr) {
            if (arr[i].time > 0) {
              arr[i].time -= 1000;
              var dd = Math.floor(arr[i].time / 1000 / 60 / 60 / 24);
              var hh = Math.floor((arr[i].time / 1000 / 60 / 60) % 24);
              var mm = Math.floor((arr[i].time / 1000 / 60) % 60);
              var ss = Math.floor((arr[i].time / 1000) % 60);
              /*if(0<=dd && dd<10){ dd='0'+dd }else */
              if (dd < 0) {
                dd = 0
              }
              /*if(0<=hh && hh<10){ hh='0'+hh }else */
              if (hh < 0) {
                hh = 0
              }
              /*if(0<=mm && mm<10){ mm='0'+mm }else */
              if (mm < 0) {
                mm = 0
              }
              /*if(0<=ss && ss<10){ ss='0'+ss }else */
              if (ss < 0) {
                ss = 0
              }
              arr[i]["dd"] = dd;
              arr[i]["hh"] = hh;
              arr[i]["mm"] = mm;
              arr[i]["ss"] = ss;
            } else {
              arr[i]["dd"] = 0;
              arr[i]["hh"] = 0;
              arr[i]["mm"] = 0;
              arr[i]["ss"] = 0;
              if (that.cateId == 0) {
                if (that.hotData[i].ongoing_status == 'coming_soon') {
                  that.hotData[i].ongoing_status = 'on_sale'
                }
                if (that.hotData[i].ongoing_status == 'offline_soon') {
                  that.hotData[i].ongoing_status = 'expired'
                }
              } else {
                if (that.proData[i].ongoing_status == 'coming_soon') {
                  that.proData[i].ongoing_status = 'on_sale'
                }
                if (that.proData[i].ongoing_status == 'offline_soon') {
                  that.proData[i].ongoing_status = 'expired'
                }
              }
            }
          }
          that.showTime = arr;
        }, 1000);
      },
      goSearch: function () {
        var that = this;
        that.serachtxt = '搜索：' + that.serachtxt
      },
      clearSearch: function () {
        var that = this;
        that.serachtxt = '';
      },
      getinitdata: function () {
        var that = this;
        var ready1 = false, ready2 = false, ready3 = false, ready4 = false;
        var load = setInterval(() => {
          if (ready1 == true && ready2 == true && ready3 == true && ready4 == true) {
            that.loaded = true;
            clearInterval(load);
            that.$nextTick(function () {
              var swiper0 = new Swiper('.top .swiper-container', {
                observer: true,
                observeParents: true,
                observeSlideChildren: true,
                watchOverflow: true,
                effect: 'fade',
                // spaceBetween:15,
                autoplay: true,
              })
              var swiper1 = new Swiper('.swiperbox .swiper-container', {
                observer: true,
                observeParents: true,
                observeSlideChildren: true,
                watchOverflow: true,
                spaceBetween:5,
                // autoHeight:true,
                pagination: {
                  el: '.swiperbox .swiper-pagination',
                }, on: {
                  slideChangeTransitionEnd: function () {
                    swiper0.slideTo(this.activeIndex, 300, false);
                  },
                },
              })
              bigimgSwiper = new Swiper('.bigimg.pop .swiper-container', {
                observer: true,
                observeParents: true,
                observeSlideChildren: true,
                watchOverflow: true,
                spaceBetween: 15,
              })
              $('.scrollbox').get(0).addEventListener('scroll', function () {
                let ele = $('.scrollbox').get(0); // 获得html
                let scrollTop = ele.scrollTop; // 向上滚动的高度
                let scrollHeight = ele.scrollHeight; // 滚动内容区域总高度
                let clientHeight = ele.clientHeight; // 可见高度
                if (clientHeight + scrollTop >= scrollHeight) { // 已经滚动到底部
                  if (that.loading == true && that.has_more == true) {
                    that.load()
                  }
                }
              })
            })
          }
        }, 100)
        // 获取banner
        common_get('banners').then(res => {
          that.bannerData = res;
          ready1 = true;
        })
        // 获取商品分类
        common_get('product_categories').then(res => {
          res.unshift({
            "name": "全部",
            "id": 0,
            "image_url": "./images/cate-all.png",
            "selected_image_url": "./images/cate-all-select.png"
          })
          that.menuData = res;
          ready2 = true;
        })
        // 获取每⽇特惠商品
        common_get('product_daily_recommend').then(res => {
          that.tehuiData = res;
          console.log(that.tehuiData);
          ready3 = true;
        })
        // 获取热⻔商品
        talent_get('products/hot?page=' + that.propage + '&limit=' + that.limit).then(res => {
          that.has_more = res.has_more;
          that.hotData = res.list;
          console.log(that.hotData);
          if (that.hotData.length > 0) {
            $(that.hotData).each((i, v) => {
              var time = 0;
              if (v.ongoing_status == 'coming_soon') {
                v.start_time = v.start_time.replace(/-/g, '/');
                time = new Date(v.start_time).getTime() - new Date().getTime();
              } else if (v.ongoing_status == 'offline_soon') {
                v.end_time = v.end_time.replace(/-/g, '/');
                time = new Date(v.end_time).getTime() - new Date().getTime();
              }
              var dd = 0, hh = 0, mm = 0, ss = 0;
              if (time > 0) {
                dd = Math.floor(time / 1000 / 60 / 60 / 24);
                hh = Math.floor((time / 1000 / 60 / 60) % 24);
                mm = Math.floor((time / 1000 / 60) % 60);
                ss = Math.floor((time / 1000) % 60);
                /*if(0<=dd && dd<10){ dd='0'+dd }else */
                if (dd < 0) {
                  dd = 0
                }
                /*if(0<=hh && hh<10){ hh='0'+hh }else */
                if (hh < 0) {
                  hh = 0
                }
                /*if(0<=mm && mm<10){ mm='0'+mm }else */
                if (mm < 0) {
                  mm = 0
                }
                /*if(0<=ss && ss<10){ ss='0'+ss }else */
                if (ss < 0) {
                  ss = 0
                }
              }
              that.showTime.push({'time': time, 'dd': dd, 'hh': hh, 'mm': mm, 'ss': ss});
            })
            that.getTimeList();
          }
          ready4 = true;
        })

      },
      changeCate: function (id) {
        var that = this;
        clearInterval(that.getTime);
        that.propage = 1;
        that.showTime = [];
        that.cateId = id;
        if (that.cateId == 0) {
          that.hotData = '';
          that.getinitdata();
        } else {
          that.proData = '';
          that.getCatePro();
        }
      },
      getCatePro: function () {
        var that = this;
        talent_get('products?category_id=' + that.cateId + '&page=' + that.propage + '&limit=' + that.limit).then(res => {
          that.has_more = res.has_more;
          that.proData = res.list;
          console.log(that.proData);
          if (that.proData.length > 0) {
            $(that.proData).each((i, v) => {
              var time = 0;
              if (v.ongoing_status == 'coming_soon') {
                v.start_time = v.start_time.replace(/-/g, '/');
                time = new Date(v.start_time).getTime() - new Date().getTime();
              } else if (v.ongoing_status == 'offline_soon') {
                v.end_time = v.end_time.replace(/-/g, '/');
                time = new Date(v.end_time).getTime() - new Date().getTime();
              }
              var dd = 0, hh = 0, mm = 0, ss = 0;
              if (time > 0) {
                dd = Math.floor(time / 1000 / 60 / 60 / 24);
                hh = Math.floor((time / 1000 / 60 / 60) % 24);
                mm = Math.floor((time / 1000 / 60) % 60);
                ss = Math.floor((time / 1000) % 60);
                /*if(0<=dd && dd<10){ dd='0'+dd }else */
                if (dd < 0) {
                  dd = 0
                }
                /*if(0<=hh && hh<10){ hh='0'+hh }else */
                if (hh < 0) {
                  hh = 0
                }
                /*if(0<=mm && mm<10){ mm='0'+mm }else */
                if (mm < 0) {
                  mm = 0
                }
                /*if(0<=ss && ss<10){ ss='0'+ss }else */
                if (ss < 0) {
                  ss = 0
                }
              }
              that.showTime.push({'time': time, 'dd': dd, 'hh': hh, 'mm': mm, 'ss': ss});
            })
            that.getTimeList();
          }
        })
      },
      load() {
        var that = this;
        that.loading = false;
        that.propage++;
        if (that.cateId == 0) {
          talent_get('products/hot?page=' + that.propage + '&limit=' + that.limit).then(res => {
            that.has_more = res.has_more;
            if (res.list.length > 0) {
              $(res.list).each((i, v) => {
                var time = 0;
                that.hotData.push(v);
                if (v.ongoing_status == 'coming_soon') {
                  v.start_time = v.start_time.replace(/-/g, '/');
                  time = new Date(v.start_time).getTime() - new Date().getTime();
                } else if (v.ongoing_status == 'offline_soon') {
                  v.end_time = v.end_time.replace(/-/g, '/');
                  time = new Date(v.end_time).getTime() - new Date().getTime();
                }
                var dd = 0, hh = 0, mm = 0, ss = 0;
                if (time > 0) {
                  dd = Math.floor(time / 1000 / 60 / 60 / 24);
                  hh = Math.floor((time / 1000 / 60 / 60) % 24);
                  mm = Math.floor((time / 1000 / 60) % 60);
                  ss = Math.floor((time / 1000) % 60);
                  /*if(0<=dd && dd<10){ dd='0'+dd }else */
                  if (dd < 0) {
                    dd = 0
                  }
                  /*if(0<=hh && hh<10){ hh='0'+hh }else */
                  if (hh < 0) {
                    hh = 0
                  }
                  /*if(0<=mm && mm<10){ mm='0'+mm }else */
                  if (mm < 0) {
                    mm = 0
                  }
                  /*if(0<=ss && ss<10){ ss='0'+ss }else */
                  if (ss < 0) {
                    ss = 0
                  }
                }
                that.showTime.push({'time': time, 'dd': dd, 'hh': hh, 'mm': mm, 'ss': ss});
              })
            }
            that.loading = true;
          })
        } else {
          talent_get('products?category_id=' + that.cateId + '&page=' + that.propage + '&limit=' + that.limit).then(res => {
            that.has_more = res.has_more;
            if (res.list.length > 0) {
              $(res.list).each((i, v) => {
                that.proData.push(v);
                var time = 0;
                if (v.ongoing_status == 'coming_soon') {
                  v.start_time = v.start_time.replace(/-/g, '/');
                  time = new Date(v.start_time).getTime() - new Date().getTime();
                } else if (v.ongoing_status == 'offline_soon') {
                  v.end_time = v.end_time.replace(/-/g, '/');
                  time = new Date(v.end_time).getTime() - new Date().getTime();
                }
                var dd = 0, hh = 0, mm = 0, ss = 0;
                if (time > 0) {
                  dd = Math.floor(time / 1000 / 60 / 60 / 24);
                  hh = Math.floor((time / 1000 / 60 / 60) % 24);
                  mm = Math.floor((time / 1000 / 60) % 60);
                  ss = Math.floor((time / 1000) % 60);
                  /*if(0<=dd && dd<10){ dd='0'+dd }else */
                  if (dd < 0) {
                    dd = 0
                  }
                  /*if(0<=hh && hh<10){ hh='0'+hh }else */
                  if (hh < 0) {
                    hh = 0
                  }
                  /*if(0<=mm && mm<10){ mm='0'+mm }else */
                  if (mm < 0) {
                    mm = 0
                  }
                  /*if(0<=ss && ss<10){ ss='0'+ss }else */
                  if (ss < 0) {
                    ss = 0
                  }
                }
                that.showTime.push({'time': time, 'dd': dd, 'hh': hh, 'mm': mm, 'ss': ss});
              })
            }
            that.loading = true;
          })
        }
      },
      openpop: function () {
        var that = this;
        if (that.allowclick == true) {
          that.allowclick = false;
          $('.indexcode.pop').fadeIn(500);
          setTimeout(() => {
            that.allowclick = true;
          }, 500)
        }
      },
      closepop: function () {
        var that = this;
        if (that.allowclick == true) {
          that.allowclick = false;
          $('.indexcode.pop').fadeOut(500);
          setTimeout(() => {
            that.allowclick = true;
          }, 500)
        }
      },
      openhbpop: function (type, index) {
        var that = this;
        let product;
        if (type == 'tehuiData') {
          product = that.tehuiData;
        } else if (type == 'hotData') {
          product = that.hotData[index];
        } else if (type == 'proData') {
          product = that.proData[index];
        }

        that.hbprofit = product.min_talent_profit;
        if (product.min_talent_profit !== product.max_talent_profit) {
          that.hbprofit += ' - ' + product.max_talent_profit;
        }
        that.hbtxt = '【' + product.title + '】' + product.intro;
        that.hbimg = product.poster_image_url;
        that.hbimgs = [product.poster_image_url].concat(product.images);
        that.product_id = product.id;
        that.makecodeOne();
        $('.hbpop.pop').fadeIn(500);
      },
      closehbpop: function (type) {
        var that = this;
        $('.hbpop.pop').fadeOut(500);
      },
      copy: function () {
        var that = this;
        var clipboard = new ClipboardJS('.copy-btn', {
          text: function () {
            return that.hbtxt;
          },
        });
        clipboard.on('success', function (e) {
          console.log(e);
          layer.msg('复制成功');
          clipboard.destroy()
        });
        clipboard.on('error', function (e) {
          console.log(e);
          layer.msg('复制失败');
          clipboard.destroy()
        });
      },
      openbigimg: function (index) {
        var that = this;
        if (index == 0) {
          var canvas2 = document.createElement("canvas");
          var _canvas = $('.hbcanvas').get(0);
          var w = parseInt(window.getComputedStyle(_canvas).width);
          var h = parseInt(window.getComputedStyle(_canvas).height);
          canvas2.width = w;
          canvas2.height = h;
          canvas2.style.width = w + "px";
          canvas2.style.height = h + "px";
          var context = canvas2.getContext("2d");
          var img=new Image();
          img.src=that.hbimg;
          var index = layer.load(1, {shade: [0.6, '#000']});
          img.onload=function(){
            console.log('loaded');
            html2canvas(_canvas, {
                scrollY: 0,
                scrollX: 0,
                useCORS: true,
                canvas: canvas2,
                backgroundColor: null,
                scale: 3
            }).then(function (canvas) {
                layer.close(index);
                that.hb = canvas.toDataURL('image/png');
                setTimeout(() => {
                $('.pop.bigimg .wrap .wrapcon').addClass('type1');
                $('.bigimg.pop .type1').fadeIn(0);
                $('.bigimg.pop').fadeIn(500);
                }, 100)
            });
          }
          
        } else {
          var initindex = index - 1;
          bigimgSwiper.update();
          $('.bigimg.pop .type2').fadeIn(0);
          bigimgSwiper.slideTo(initindex, 0, false);
          $('.bigimg.pop').fadeIn(500);
        }
      },
      closebigimg: function (type) {
        var that = this;
        $('.bigimg.pop').fadeOut(500);
        setTimeout(() => {
          $('.bigimg.pop .popcon').fadeOut(0);
          $('.pop.bigimg .wrap .wrapcon').removeClass('type1');
        }, 500)
      },
      makecodeOne: function () {
        var that = this;
        var qrcodetxt = 'https://prod.baotuan.vip/product/' + that.product_id + '/by/' + that.user_info.talent_id;
        console.log(qrcodetxt)
        qrcode = new QRCode($('#qrcodeOne').get(0), {
          text: qrcodetxt,
          width: 128,
          height: 128,
          colorDark: "#000000",
          colorLight: "#ffffff",
          correctLevel: QRCode.CorrectLevel.H
        });
      },

    }
  });
</script>
</html>